# $ANTLR 3.1 Gencfa.g 2008-09-30 02:21:11

import sys
from antlr3 import *
from antlr3.compat import set, frozenset


# for convenience in actions
HIDDEN = BaseRecognizer.HIDDEN

# token types
STAR=21
RULE=19
TARGETALPHA=36
TARGETHUE=33
TARGETSATURATION=34
MOD=11
STARTSHAPE=13
USER_RATIONAL_TARGET=32
XSHIFT=24
RIGHTBRACKET=17
BG=7
USER_STRING=14
WHITESPACE=39
TARGETBRIGHTNESS=35
ROTATE=22
EOF=-1
SATURATION=29
STATEMENT=5
ALPHA=31
NAME=8
CFGD=4
BACKGROUND=15
LEFTBRACE=37
USER_RATIONAL=20
BRIGHTNESS=30
ZSHIFT=26
REPLACEMENT=9
SKEW=27
LOOP=10
FLIP=23
RIGHTBRACE=38
HUE=28
ADJ=12
INIT=6
SIZE=18
YSHIFT=25
LEFTBRACKET=16

# token names
tokenNames = [
    "<invalid>", "<EOR>", "<DOWN>", "<UP>", 
    "CFGD", "STATEMENT", "INIT", "BG", "NAME", "REPLACEMENT", "LOOP", "MOD", 
    "ADJ", "STARTSHAPE", "USER_STRING", "BACKGROUND", "LEFTBRACKET", "RIGHTBRACKET", 
    "SIZE", "RULE", "USER_RATIONAL", "STAR", "ROTATE", "FLIP", "XSHIFT", 
    "YSHIFT", "ZSHIFT", "SKEW", "HUE", "SATURATION", "BRIGHTNESS", "ALPHA", 
    "USER_RATIONAL_TARGET", "TARGETHUE", "TARGETSATURATION", "TARGETBRIGHTNESS", 
    "TARGETALPHA", "LEFTBRACE", "RIGHTBRACE", "WHITESPACE"
]




class GencfaParser(Parser):
    grammarFileName = "Gencfa.g"
    antlr_version = version_str_to_tuple("3.1")
    antlr_version_str = "3.1"
    tokenNames = tokenNames

    def __init__(self, input, state=None):
        if state is None:
            state = RecognizerSharedState()

        Parser.__init__(self, input, state)


        self.dfa11 = self.DFA11(
            self, 11,
            eot = self.DFA11_eot,
            eof = self.DFA11_eof,
            min = self.DFA11_min,
            max = self.DFA11_max,
            accept = self.DFA11_accept,
            special = self.DFA11_special,
            transition = self.DFA11_transition
            )

        self.dfa12 = self.DFA12(
            self, 12,
            eot = self.DFA12_eot,
            eof = self.DFA12_eof,
            min = self.DFA12_min,
            max = self.DFA12_max,
            accept = self.DFA12_accept,
            special = self.DFA12_special,
            transition = self.DFA12_transition
            )


    sshape = ''
    bground =[]
    names=[]
    rule_name=[]
    invoc=[]



    # $ANTLR start "cfdg"
    # Gencfa.g:29:1: cfdg : stm_list ;
    def cfdg(self, ):
        self.sshape = ''
        self.bground =[]
        self.names=[]
        self.rule_name=[]
        self.invoc=[]
        try:
            try:
                # Gencfa.g:29:6: ( stm_list )
                # Gencfa.g:29:8: stm_list
                pass 
                self._state.following.append(self.FOLLOW_stm_list_in_cfdg71)
                self.stm_list()

                self._state.following.pop()




            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "cfdg"


    # $ANTLR start "stm_list"
    # Gencfa.g:32:1: stm_list : ( statement )+ ;
    def stm_list(self, ):

        try:
            try:
                # Gencfa.g:32:9: ( ( statement )+ )
                # Gencfa.g:32:11: ( statement )+
                pass 
                # Gencfa.g:32:11: ( statement )+
                cnt1 = 0
                while True: #loop1
                    alt1 = 2
                    LA1_0 = self.input.LA(1)

                    if (LA1_0 == STARTSHAPE or LA1_0 == BACKGROUND or LA1_0 == RULE) :
                        alt1 = 1


                    if alt1 == 1:
                        # Gencfa.g:32:12: statement
                        pass 
                        self._state.following.append(self.FOLLOW_statement_in_stm_list82)
                        self.statement()

                        self._state.following.pop()


                    else:
                        if cnt1 >= 1:
                            break #loop1

                        eee = EarlyExitException(1, self.input)
                        raise eee

                    cnt1 += 1






            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "stm_list"


    # $ANTLR start "statement"
    # Gencfa.g:35:1: statement : ( initialization | background | rule );
    def statement(self, ):

        try:
            try:
                # Gencfa.g:36:2: ( initialization | background | rule )
                alt2 = 3
                LA2 = self.input.LA(1)
                if LA2 == STARTSHAPE:
                    alt2 = 1
                elif LA2 == BACKGROUND:
                    alt2 = 2
                elif LA2 == RULE:
                    alt2 = 3
                else:
                    nvae = NoViableAltException("", 2, 0, self.input)

                    raise nvae

                if alt2 == 1:
                    # Gencfa.g:36:4: initialization
                    pass 
                    self._state.following.append(self.FOLLOW_initialization_in_statement96)
                    self.initialization()

                    self._state.following.pop()


                elif alt2 == 2:
                    # Gencfa.g:37:4: background
                    pass 
                    self._state.following.append(self.FOLLOW_background_in_statement101)
                    self.background()

                    self._state.following.pop()


                elif alt2 == 3:
                    # Gencfa.g:38:4: rule
                    pass 
                    self._state.following.append(self.FOLLOW_rule_in_statement106)
                    self.rule()

                    self._state.following.pop()



            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "statement"


    # $ANTLR start "initialization"
    # Gencfa.g:41:1: initialization : STARTSHAPE USER_STRING ;
    def initialization(self, ):

        USER_STRING1 = None

        try:
            try:
                # Gencfa.g:42:2: ( STARTSHAPE USER_STRING )
                # Gencfa.g:42:4: STARTSHAPE USER_STRING
                pass 
                self.match(self.input, STARTSHAPE, self.FOLLOW_STARTSHAPE_in_initialization118)
                USER_STRING1=self.match(self.input, USER_STRING, self.FOLLOW_USER_STRING_in_initialization120)
                #action start
                self.sshape = USER_STRING1.text;
                #action end




            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "initialization"


    # $ANTLR start "background"
    # Gencfa.g:45:1: background : BACKGROUND LEFTBRACKET ( buncha_color_adjustments )? RIGHTBRACKET ;
    def background(self, ):

        buncha_color_adjustments2 = None


        try:
            try:
                # Gencfa.g:46:2: ( BACKGROUND LEFTBRACKET ( buncha_color_adjustments )? RIGHTBRACKET )
                # Gencfa.g:46:4: BACKGROUND LEFTBRACKET ( buncha_color_adjustments )? RIGHTBRACKET
                pass 
                self.match(self.input, BACKGROUND, self.FOLLOW_BACKGROUND_in_background134)
                self.match(self.input, LEFTBRACKET, self.FOLLOW_LEFTBRACKET_in_background136)
                # Gencfa.g:46:27: ( buncha_color_adjustments )?
                alt3 = 2
                LA3_0 = self.input.LA(1)

                if ((HUE <= LA3_0 <= ALPHA) or (TARGETHUE <= LA3_0 <= TARGETALPHA)) :
                    alt3 = 1
                if alt3 == 1:
                    # Gencfa.g:46:27: buncha_color_adjustments
                    pass 
                    self._state.following.append(self.FOLLOW_buncha_color_adjustments_in_background138)
                    buncha_color_adjustments2 = self.buncha_color_adjustments()

                    self._state.following.pop()



                self.match(self.input, RIGHTBRACKET, self.FOLLOW_RIGHTBRACKET_in_background141)
                #action start
                self.bground.append(((buncha_color_adjustments2 is not None) and [self.input.toString(buncha_color_adjustments2.start,buncha_color_adjustments2.stop)] or [None])[0]);
                #action end




            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "background"


    # $ANTLR start "size"
    # Gencfa.g:49:1: size : SIZE modification ;
    def size(self, ):

        try:
            try:
                # Gencfa.g:49:6: ( SIZE modification )
                # Gencfa.g:49:8: SIZE modification
                pass 
                self.match(self.input, SIZE, self.FOLLOW_SIZE_in_size154)
                self._state.following.append(self.FOLLOW_modification_in_size156)
                self.modification()

                self._state.following.pop()




            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "size"


    # $ANTLR start "rule"
    # Gencfa.g:57:1: rule : RULE USER_STRING ( USER_RATIONAL )? LEFTBRACKET ( buncha_replacements )? RIGHTBRACKET ;
    def rule(self, ):

        USER_STRING3 = None

              
        self.rule_name=[]
        print "PARSER: NEW RULE"

        try:
            try:
                # Gencfa.g:66:1: ( RULE USER_STRING ( USER_RATIONAL )? LEFTBRACKET ( buncha_replacements )? RIGHTBRACKET )
                # Gencfa.g:66:3: RULE USER_STRING ( USER_RATIONAL )? LEFTBRACKET ( buncha_replacements )? RIGHTBRACKET
                pass 
                self.match(self.input, RULE, self.FOLLOW_RULE_in_rule176)
                USER_STRING3=self.match(self.input, USER_STRING, self.FOLLOW_USER_STRING_in_rule178)
                # Gencfa.g:66:20: ( USER_RATIONAL )?
                alt4 = 2
                LA4_0 = self.input.LA(1)

                if (LA4_0 == USER_RATIONAL) :
                    alt4 = 1
                if alt4 == 1:
                    # Gencfa.g:66:21: USER_RATIONAL
                    pass 
                    self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_rule181)



                self.match(self.input, LEFTBRACKET, self.FOLLOW_LEFTBRACKET_in_rule185)
                # Gencfa.g:66:49: ( buncha_replacements )?
                alt5 = 2
                LA5_0 = self.input.LA(1)

                if (LA5_0 == USER_STRING) :
                    alt5 = 1
                if alt5 == 1:
                    # Gencfa.g:66:49: buncha_replacements
                    pass 
                    self._state.following.append(self.FOLLOW_buncha_replacements_in_rule187)
                    self.buncha_replacements()

                    self._state.following.pop()



                self.match(self.input, RIGHTBRACKET, self.FOLLOW_RIGHTBRACKET_in_rule190)
                #action start
                self.rule_name.append(USER_STRING3.text); print USER_STRING3.text;
                #action end



                #action start
                       
                self.names.append(self.rule_name);
                print "PARSER: END RULE: " + str(self.names);

                #action end

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "rule"


    # $ANTLR start "buncha_replacements"
    # Gencfa.g:70:1: buncha_replacements : ( replacement )+ ;
    def buncha_replacements(self, ):

        try:
            try:
                # Gencfa.g:71:2: ( ( replacement )+ )
                # Gencfa.g:71:4: ( replacement )+
                pass 
                # Gencfa.g:71:4: ( replacement )+
                cnt6 = 0
                while True: #loop6
                    alt6 = 2
                    LA6_0 = self.input.LA(1)

                    if (LA6_0 == USER_STRING) :
                        alt6 = 1


                    if alt6 == 1:
                        # Gencfa.g:71:5: replacement
                        pass 
                        self._state.following.append(self.FOLLOW_replacement_in_buncha_replacements206)
                        self.replacement()

                        self._state.following.pop()


                    else:
                        if cnt6 >= 1:
                            break #loop6

                        eee = EarlyExitException(6, self.input)
                        raise eee

                    cnt6 += 1






            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "buncha_replacements"


    # $ANTLR start "replacement"
    # Gencfa.g:74:1: replacement : ( USER_STRING modification | USER_STRING STAR m1= modification USER_STRING m2= modification );
    def replacement(self, ):

        USER_STRING4 = None

              
        self.invoc=[]
        print "PARSER: NEW INVOCATION"

        try:
            try:
                # Gencfa.g:82:2: ( USER_STRING modification | USER_STRING STAR m1= modification USER_STRING m2= modification )
                alt7 = 2
                LA7_0 = self.input.LA(1)

                if (LA7_0 == USER_STRING) :
                    LA7_1 = self.input.LA(2)

                    if (LA7_1 == STAR) :
                        alt7 = 2
                    elif (LA7_1 == LEFTBRACKET) :
                        alt7 = 1
                    else:
                        nvae = NoViableAltException("", 7, 1, self.input)

                        raise nvae

                else:
                    nvae = NoViableAltException("", 7, 0, self.input)

                    raise nvae

                if alt7 == 1:
                    # Gencfa.g:82:4: USER_STRING modification
                    pass 
                    USER_STRING4=self.match(self.input, USER_STRING, self.FOLLOW_USER_STRING_in_replacement230)
                    self._state.following.append(self.FOLLOW_modification_in_replacement232)
                    self.modification()

                    self._state.following.pop()
                    #action start
                    self.invoc.append(USER_STRING4.text);
                    #action end


                elif alt7 == 2:
                    # Gencfa.g:83:4: USER_STRING STAR m1= modification USER_STRING m2= modification
                    pass 
                    self.match(self.input, USER_STRING, self.FOLLOW_USER_STRING_in_replacement244)
                    self.match(self.input, STAR, self.FOLLOW_STAR_in_replacement246)
                    self._state.following.append(self.FOLLOW_modification_in_replacement250)
                    self.modification()

                    self._state.following.pop()
                    self.match(self.input, USER_STRING, self.FOLLOW_USER_STRING_in_replacement252)
                    self._state.following.append(self.FOLLOW_modification_in_replacement256)
                    self.modification()

                    self._state.following.pop()


                #action start
                        
                self.rule_name.append(self.invoc);

                #action end

            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "replacement"


    # $ANTLR start "modification"
    # Gencfa.g:93:1: modification : LEFTBRACKET ( buncha_adjustments )? RIGHTBRACKET ;
    def modification(self, ):

        try:
            try:
                # Gencfa.g:94:2: ( LEFTBRACKET ( buncha_adjustments )? RIGHTBRACKET )
                # Gencfa.g:94:4: LEFTBRACKET ( buncha_adjustments )? RIGHTBRACKET
                pass 
                self.match(self.input, LEFTBRACKET, self.FOLLOW_LEFTBRACKET_in_modification273)
                # Gencfa.g:94:16: ( buncha_adjustments )?
                alt8 = 2
                LA8_0 = self.input.LA(1)

                if (LA8_0 == SIZE or (ROTATE <= LA8_0 <= ALPHA) or (TARGETHUE <= LA8_0 <= TARGETALPHA)) :
                    alt8 = 1
                if alt8 == 1:
                    # Gencfa.g:94:16: buncha_adjustments
                    pass 
                    self._state.following.append(self.FOLLOW_buncha_adjustments_in_modification275)
                    self.buncha_adjustments()

                    self._state.following.pop()



                self.match(self.input, RIGHTBRACKET, self.FOLLOW_RIGHTBRACKET_in_modification278)




            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "modification"


    # $ANTLR start "buncha_adjustments"
    # Gencfa.g:97:1: buncha_adjustments : ( adjustment )+ ;
    def buncha_adjustments(self, ):

        try:
            try:
                # Gencfa.g:98:2: ( ( adjustment )+ )
                # Gencfa.g:98:4: ( adjustment )+
                pass 
                # Gencfa.g:98:4: ( adjustment )+
                cnt9 = 0
                while True: #loop9
                    alt9 = 2
                    LA9_0 = self.input.LA(1)

                    if (LA9_0 == SIZE or (ROTATE <= LA9_0 <= ALPHA) or (TARGETHUE <= LA9_0 <= TARGETALPHA)) :
                        alt9 = 1


                    if alt9 == 1:
                        # Gencfa.g:98:5: adjustment
                        pass 
                        self._state.following.append(self.FOLLOW_adjustment_in_buncha_adjustments291)
                        self.adjustment()

                        self._state.following.pop()


                    else:
                        if cnt9 >= 1:
                            break #loop9

                        eee = EarlyExitException(9, self.input)
                        raise eee

                    cnt9 += 1






            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "buncha_adjustments"

    class buncha_color_adjustments_return(ParserRuleReturnScope):
        def __init__(self):
            ParserRuleReturnScope.__init__(self)





    # $ANTLR start "buncha_color_adjustments"
    # Gencfa.g:101:1: buncha_color_adjustments : ( color_adjustment )+ ;
    def buncha_color_adjustments(self, ):

        retval = self.buncha_color_adjustments_return()
        retval.start = self.input.LT(1)

        try:
            try:
                # Gencfa.g:102:2: ( ( color_adjustment )+ )
                # Gencfa.g:102:4: ( color_adjustment )+
                pass 
                # Gencfa.g:102:4: ( color_adjustment )+
                cnt10 = 0
                while True: #loop10
                    alt10 = 2
                    LA10_0 = self.input.LA(1)

                    if ((HUE <= LA10_0 <= ALPHA) or (TARGETHUE <= LA10_0 <= TARGETALPHA)) :
                        alt10 = 1


                    if alt10 == 1:
                        # Gencfa.g:102:5: color_adjustment
                        pass 
                        self._state.following.append(self.FOLLOW_color_adjustment_in_buncha_color_adjustments305)
                        self.color_adjustment()

                        self._state.following.pop()


                    else:
                        if cnt10 >= 1:
                            break #loop10

                        eee = EarlyExitException(10, self.input)
                        raise eee

                    cnt10 += 1





                retval.stop = self.input.LT(-1)


            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return retval

    # $ANTLR end "buncha_color_adjustments"


    # $ANTLR start "adjustment"
    # Gencfa.g:105:1: adjustment : ( ROTATE USER_RATIONAL | FLIP USER_RATIONAL | XSHIFT USER_RATIONAL | YSHIFT USER_RATIONAL | ZSHIFT USER_RATIONAL | SIZE USER_RATIONAL | SIZE a1= USER_RATIONAL a2= USER_RATIONAL | SIZE a1= USER_RATIONAL a2= USER_RATIONAL a3= USER_RATIONAL | SKEW a1= USER_RATIONAL a2= USER_RATIONAL | color_adjustment );
    def adjustment(self, ):

        a1 = None
        a2 = None
        a3 = None
        ROTATE5 = None
        USER_RATIONAL6 = None
        FLIP7 = None
        USER_RATIONAL8 = None
        XSHIFT9 = None
        USER_RATIONAL10 = None
        YSHIFT11 = None
        USER_RATIONAL12 = None
        ZSHIFT13 = None
        USER_RATIONAL14 = None
        SIZE15 = None
        USER_RATIONAL16 = None
        SIZE17 = None
        SIZE18 = None
        SKEW19 = None

        try:
            try:
                # Gencfa.g:106:2: ( ROTATE USER_RATIONAL | FLIP USER_RATIONAL | XSHIFT USER_RATIONAL | YSHIFT USER_RATIONAL | ZSHIFT USER_RATIONAL | SIZE USER_RATIONAL | SIZE a1= USER_RATIONAL a2= USER_RATIONAL | SIZE a1= USER_RATIONAL a2= USER_RATIONAL a3= USER_RATIONAL | SKEW a1= USER_RATIONAL a2= USER_RATIONAL | color_adjustment )
                alt11 = 10
                alt11 = self.dfa11.predict(self.input)
                if alt11 == 1:
                    # Gencfa.g:106:4: ROTATE USER_RATIONAL
                    pass 
                    ROTATE5=self.match(self.input, ROTATE, self.FOLLOW_ROTATE_in_adjustment319)
                    USER_RATIONAL6=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment321)
                    #action start
                    self.invoc.append(ROTATE5.text + " " + USER_RATIONAL6.text);
                    #action end


                elif alt11 == 2:
                    # Gencfa.g:107:4: FLIP USER_RATIONAL
                    pass 
                    FLIP7=self.match(self.input, FLIP, self.FOLLOW_FLIP_in_adjustment336)
                    USER_RATIONAL8=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment338)
                    #action start
                    self.invoc.append(FLIP7.text + " " + USER_RATIONAL8.text);
                    #action end


                elif alt11 == 3:
                    # Gencfa.g:108:4: XSHIFT USER_RATIONAL
                    pass 
                    XSHIFT9=self.match(self.input, XSHIFT, self.FOLLOW_XSHIFT_in_adjustment349)
                    USER_RATIONAL10=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment351)
                    #action start
                    self.invoc.append(XSHIFT9.text + " " + USER_RATIONAL10.text);
                    #action end


                elif alt11 == 4:
                    # Gencfa.g:109:4: YSHIFT USER_RATIONAL
                    pass 
                    YSHIFT11=self.match(self.input, YSHIFT, self.FOLLOW_YSHIFT_in_adjustment365)
                    USER_RATIONAL12=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment367)
                    #action start
                    self.invoc.append(YSHIFT11.text + " " + USER_RATIONAL12.text);
                    #action end


                elif alt11 == 5:
                    # Gencfa.g:110:4: ZSHIFT USER_RATIONAL
                    pass 
                    ZSHIFT13=self.match(self.input, ZSHIFT, self.FOLLOW_ZSHIFT_in_adjustment381)
                    USER_RATIONAL14=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment383)
                    #action start
                    self.invoc.append(ZSHIFT13.text + " " + USER_RATIONAL14.text);
                    #action end


                elif alt11 == 6:
                    # Gencfa.g:111:4: SIZE USER_RATIONAL
                    pass 
                    SIZE15=self.match(self.input, SIZE, self.FOLLOW_SIZE_in_adjustment397)
                    USER_RATIONAL16=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment399)
                    #action start
                    self.invoc.append(SIZE15.text + " " + USER_RATIONAL16.text);
                    #action end


                elif alt11 == 7:
                    # Gencfa.g:112:4: SIZE a1= USER_RATIONAL a2= USER_RATIONAL
                    pass 
                    SIZE17=self.match(self.input, SIZE, self.FOLLOW_SIZE_in_adjustment413)
                    a1=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment417)
                    a2=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment421)
                    #action start
                    self.invoc.append(SIZE17.text + " " + a1.text + " " + a2.text);
                    #action end


                elif alt11 == 8:
                    # Gencfa.g:113:4: SIZE a1= USER_RATIONAL a2= USER_RATIONAL a3= USER_RATIONAL
                    pass 
                    SIZE18=self.match(self.input, SIZE, self.FOLLOW_SIZE_in_adjustment430)
                    a1=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment434)
                    a2=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment438)
                    a3=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment442)
                    #action start
                    self.invoc.append(SIZE18.text + " " + a1.text + " " + a2.text+ " " + a3.text);
                    #action end


                elif alt11 == 9:
                    # Gencfa.g:114:4: SKEW a1= USER_RATIONAL a2= USER_RATIONAL
                    pass 
                    SKEW19=self.match(self.input, SKEW, self.FOLLOW_SKEW_in_adjustment449)
                    a1=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment453)
                    a2=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_adjustment457)
                    #action start
                    self.invoc.append(SKEW19.text + " " + a1.text + " " + a2.text);
                    #action end


                elif alt11 == 10:
                    # Gencfa.g:115:4: color_adjustment
                    pass 
                    self._state.following.append(self.FOLLOW_color_adjustment_in_adjustment466)
                    self.color_adjustment()

                    self._state.following.pop()



            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "adjustment"


    # $ANTLR start "color_adjustment"
    # Gencfa.g:118:1: color_adjustment : ( HUE USER_RATIONAL | SATURATION USER_RATIONAL | BRIGHTNESS USER_RATIONAL | ALPHA USER_RATIONAL | HUE USER_RATIONAL_TARGET | SATURATION USER_RATIONAL_TARGET | BRIGHTNESS USER_RATIONAL_TARGET | ALPHA USER_RATIONAL_TARGET | TARGETHUE USER_RATIONAL | TARGETSATURATION USER_RATIONAL | TARGETBRIGHTNESS USER_RATIONAL | TARGETALPHA USER_RATIONAL );
    def color_adjustment(self, ):

        HUE20 = None
        USER_RATIONAL21 = None
        SATURATION22 = None
        USER_RATIONAL23 = None
        BRIGHTNESS24 = None
        USER_RATIONAL25 = None
        ALPHA26 = None
        USER_RATIONAL27 = None
        HUE28 = None
        USER_RATIONAL_TARGET29 = None
        SATURATION30 = None
        USER_RATIONAL_TARGET31 = None
        BRIGHTNESS32 = None
        USER_RATIONAL_TARGET33 = None
        ALPHA34 = None
        USER_RATIONAL_TARGET35 = None
        TARGETHUE36 = None
        USER_RATIONAL37 = None
        TARGETSATURATION38 = None
        USER_RATIONAL39 = None
        TARGETBRIGHTNESS40 = None
        USER_RATIONAL41 = None
        TARGETALPHA42 = None
        USER_RATIONAL43 = None

        try:
            try:
                # Gencfa.g:119:2: ( HUE USER_RATIONAL | SATURATION USER_RATIONAL | BRIGHTNESS USER_RATIONAL | ALPHA USER_RATIONAL | HUE USER_RATIONAL_TARGET | SATURATION USER_RATIONAL_TARGET | BRIGHTNESS USER_RATIONAL_TARGET | ALPHA USER_RATIONAL_TARGET | TARGETHUE USER_RATIONAL | TARGETSATURATION USER_RATIONAL | TARGETBRIGHTNESS USER_RATIONAL | TARGETALPHA USER_RATIONAL )
                alt12 = 12
                alt12 = self.dfa12.predict(self.input)
                if alt12 == 1:
                    # Gencfa.g:119:4: HUE USER_RATIONAL
                    pass 
                    HUE20=self.match(self.input, HUE, self.FOLLOW_HUE_in_color_adjustment483)
                    USER_RATIONAL21=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_color_adjustment485)
                    #action start
                    self.invoc.append(HUE20.text + " " + USER_RATIONAL21.text);
                    #action end


                elif alt12 == 2:
                    # Gencfa.g:120:11: SATURATION USER_RATIONAL
                    pass 
                    SATURATION22=self.match(self.input, SATURATION, self.FOLLOW_SATURATION_in_color_adjustment501)
                    USER_RATIONAL23=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_color_adjustment503)
                    #action start
                    self.invoc.append(SATURATION22.text + " " + USER_RATIONAL23.text);
                    #action end


                elif alt12 == 3:
                    # Gencfa.g:121:11: BRIGHTNESS USER_RATIONAL
                    pass 
                    BRIGHTNESS24=self.match(self.input, BRIGHTNESS, self.FOLLOW_BRIGHTNESS_in_color_adjustment518)
                    USER_RATIONAL25=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_color_adjustment520)
                    #action start
                    self.invoc.append(BRIGHTNESS24.text + " " + USER_RATIONAL25.text);
                    #action end


                elif alt12 == 4:
                    # Gencfa.g:122:11: ALPHA USER_RATIONAL
                    pass 
                    ALPHA26=self.match(self.input, ALPHA, self.FOLLOW_ALPHA_in_color_adjustment535)
                    USER_RATIONAL27=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_color_adjustment537)
                    #action start
                    self.invoc.append(ALPHA26.text + " " + USER_RATIONAL27.text);
                    #action end


                elif alt12 == 5:
                    # Gencfa.g:123:11: HUE USER_RATIONAL_TARGET
                    pass 
                    HUE28=self.match(self.input, HUE, self.FOLLOW_HUE_in_color_adjustment553)
                    USER_RATIONAL_TARGET29=self.match(self.input, USER_RATIONAL_TARGET, self.FOLLOW_USER_RATIONAL_TARGET_in_color_adjustment555)
                    #action start
                    self.invoc.append(HUE28.text + " " + USER_RATIONAL_TARGET29.text);
                    #action end


                elif alt12 == 6:
                    # Gencfa.g:124:11: SATURATION USER_RATIONAL_TARGET
                    pass 
                    SATURATION30=self.match(self.input, SATURATION, self.FOLLOW_SATURATION_in_color_adjustment570)
                    USER_RATIONAL_TARGET31=self.match(self.input, USER_RATIONAL_TARGET, self.FOLLOW_USER_RATIONAL_TARGET_in_color_adjustment572)
                    #action start
                    self.invoc.append(SATURATION30.text + " " + USER_RATIONAL_TARGET31.text);
                    #action end


                elif alt12 == 7:
                    # Gencfa.g:125:11: BRIGHTNESS USER_RATIONAL_TARGET
                    pass 
                    BRIGHTNESS32=self.match(self.input, BRIGHTNESS, self.FOLLOW_BRIGHTNESS_in_color_adjustment587)
                    USER_RATIONAL_TARGET33=self.match(self.input, USER_RATIONAL_TARGET, self.FOLLOW_USER_RATIONAL_TARGET_in_color_adjustment589)
                    #action start
                    self.invoc.append(BRIGHTNESS32.text + " " + USER_RATIONAL_TARGET33.text);
                    #action end


                elif alt12 == 8:
                    # Gencfa.g:126:11: ALPHA USER_RATIONAL_TARGET
                    pass 
                    ALPHA34=self.match(self.input, ALPHA, self.FOLLOW_ALPHA_in_color_adjustment604)
                    USER_RATIONAL_TARGET35=self.match(self.input, USER_RATIONAL_TARGET, self.FOLLOW_USER_RATIONAL_TARGET_in_color_adjustment606)
                    #action start
                    self.invoc.append(ALPHA34.text + " " + USER_RATIONAL_TARGET35.text);
                    #action end


                elif alt12 == 9:
                    # Gencfa.g:127:11: TARGETHUE USER_RATIONAL
                    pass 
                    TARGETHUE36=self.match(self.input, TARGETHUE, self.FOLLOW_TARGETHUE_in_color_adjustment621)
                    USER_RATIONAL37=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_color_adjustment623)
                    #action start
                    self.invoc.append(TARGETHUE36.text + " " + USER_RATIONAL37.text);
                    #action end


                elif alt12 == 10:
                    # Gencfa.g:128:11: TARGETSATURATION USER_RATIONAL
                    pass 
                    TARGETSATURATION38=self.match(self.input, TARGETSATURATION, self.FOLLOW_TARGETSATURATION_in_color_adjustment639)
                    USER_RATIONAL39=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_color_adjustment641)
                    #action start
                    self.invoc.append(TARGETSATURATION38.text + " " + USER_RATIONAL39.text);
                    #action end


                elif alt12 == 11:
                    # Gencfa.g:129:11: TARGETBRIGHTNESS USER_RATIONAL
                    pass 
                    TARGETBRIGHTNESS40=self.match(self.input, TARGETBRIGHTNESS, self.FOLLOW_TARGETBRIGHTNESS_in_color_adjustment656)
                    USER_RATIONAL41=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_color_adjustment658)
                    #action start
                    self.invoc.append(TARGETBRIGHTNESS40.text + " " + USER_RATIONAL41.text);
                    #action end


                elif alt12 == 12:
                    # Gencfa.g:130:17: TARGETALPHA USER_RATIONAL
                    pass 
                    TARGETALPHA42=self.match(self.input, TARGETALPHA, self.FOLLOW_TARGETALPHA_in_color_adjustment679)
                    USER_RATIONAL43=self.match(self.input, USER_RATIONAL, self.FOLLOW_USER_RATIONAL_in_color_adjustment681)
                    #action start
                    self.invoc.append(TARGETALPHA42.text + " " + USER_RATIONAL43.text);
                    #action end



            except RecognitionException, re:
                self.reportError(re)
                self.recover(self.input, re)
        finally:

            pass

        return 

    # $ANTLR end "color_adjustment"


    # Delegated rules


    # lookup tables for DFA #11

    DFA11_eot = DFA.unpack(
        u"\16\uffff"
        )

    DFA11_eof = DFA.unpack(
        u"\16\uffff"
        )

    DFA11_min = DFA.unpack(
        u"\1\22\5\uffff\1\24\2\uffff\2\21\3\uffff"
        )

    DFA11_max = DFA.unpack(
        u"\1\44\5\uffff\1\24\2\uffff\2\44\3\uffff"
        )

    DFA11_accept = DFA.unpack(
        u"\1\uffff\1\1\1\2\1\3\1\4\1\5\1\uffff\1\11\1\12\2\uffff\1\6\1\10"
        u"\1\7"
        )

    DFA11_special = DFA.unpack(
        u"\16\uffff"
        )

            
    DFA11_transition = [
        DFA.unpack(u"\1\6\3\uffff\1\1\1\2\1\3\1\4\1\5\1\7\4\10\1\uffff\4"
        u"\10"),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u"\1\11"),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u"\2\13\1\uffff\1\12\1\uffff\12\13\1\uffff\4\13"),
        DFA.unpack(u"\2\15\1\uffff\1\14\1\uffff\12\15\1\uffff\4\15"),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u"")
    ]

    # class definition for DFA #11

    DFA11 = DFA
    # lookup tables for DFA #12

    DFA12_eot = DFA.unpack(
        u"\21\uffff"
        )

    DFA12_eof = DFA.unpack(
        u"\21\uffff"
        )

    DFA12_min = DFA.unpack(
        u"\1\34\4\24\14\uffff"
        )

    DFA12_max = DFA.unpack(
        u"\1\44\4\40\14\uffff"
        )

    DFA12_accept = DFA.unpack(
        u"\5\uffff\1\11\1\12\1\13\1\14\1\1\1\5\1\2\1\6\1\3\1\7\1\4\1\10"
        )

    DFA12_special = DFA.unpack(
        u"\21\uffff"
        )

            
    DFA12_transition = [
        DFA.unpack(u"\1\1\1\2\1\3\1\4\1\uffff\1\5\1\6\1\7\1\10"),
        DFA.unpack(u"\1\11\13\uffff\1\12"),
        DFA.unpack(u"\1\13\13\uffff\1\14"),
        DFA.unpack(u"\1\15\13\uffff\1\16"),
        DFA.unpack(u"\1\17\13\uffff\1\20"),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u""),
        DFA.unpack(u"")
    ]

    # class definition for DFA #12

    DFA12 = DFA
 

    FOLLOW_stm_list_in_cfdg71 = frozenset([1])
    FOLLOW_statement_in_stm_list82 = frozenset([1, 13, 15, 19])
    FOLLOW_initialization_in_statement96 = frozenset([1])
    FOLLOW_background_in_statement101 = frozenset([1])
    FOLLOW_rule_in_statement106 = frozenset([1])
    FOLLOW_STARTSHAPE_in_initialization118 = frozenset([14])
    FOLLOW_USER_STRING_in_initialization120 = frozenset([1])
    FOLLOW_BACKGROUND_in_background134 = frozenset([16])
    FOLLOW_LEFTBRACKET_in_background136 = frozenset([17, 28, 29, 30, 31, 33, 34, 35, 36])
    FOLLOW_buncha_color_adjustments_in_background138 = frozenset([17])
    FOLLOW_RIGHTBRACKET_in_background141 = frozenset([1])
    FOLLOW_SIZE_in_size154 = frozenset([16])
    FOLLOW_modification_in_size156 = frozenset([1])
    FOLLOW_RULE_in_rule176 = frozenset([14])
    FOLLOW_USER_STRING_in_rule178 = frozenset([16, 20])
    FOLLOW_USER_RATIONAL_in_rule181 = frozenset([16])
    FOLLOW_LEFTBRACKET_in_rule185 = frozenset([14, 17])
    FOLLOW_buncha_replacements_in_rule187 = frozenset([17])
    FOLLOW_RIGHTBRACKET_in_rule190 = frozenset([1])
    FOLLOW_replacement_in_buncha_replacements206 = frozenset([1, 14])
    FOLLOW_USER_STRING_in_replacement230 = frozenset([16])
    FOLLOW_modification_in_replacement232 = frozenset([1])
    FOLLOW_USER_STRING_in_replacement244 = frozenset([21])
    FOLLOW_STAR_in_replacement246 = frozenset([16])
    FOLLOW_modification_in_replacement250 = frozenset([14])
    FOLLOW_USER_STRING_in_replacement252 = frozenset([16])
    FOLLOW_modification_in_replacement256 = frozenset([1])
    FOLLOW_LEFTBRACKET_in_modification273 = frozenset([17, 18, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36])
    FOLLOW_buncha_adjustments_in_modification275 = frozenset([17])
    FOLLOW_RIGHTBRACKET_in_modification278 = frozenset([1])
    FOLLOW_adjustment_in_buncha_adjustments291 = frozenset([1, 18, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36])
    FOLLOW_color_adjustment_in_buncha_color_adjustments305 = frozenset([1, 18, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36])
    FOLLOW_ROTATE_in_adjustment319 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment321 = frozenset([1])
    FOLLOW_FLIP_in_adjustment336 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment338 = frozenset([1])
    FOLLOW_XSHIFT_in_adjustment349 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment351 = frozenset([1])
    FOLLOW_YSHIFT_in_adjustment365 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment367 = frozenset([1])
    FOLLOW_ZSHIFT_in_adjustment381 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment383 = frozenset([1])
    FOLLOW_SIZE_in_adjustment397 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment399 = frozenset([1])
    FOLLOW_SIZE_in_adjustment413 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment417 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment421 = frozenset([1])
    FOLLOW_SIZE_in_adjustment430 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment434 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment438 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment442 = frozenset([1])
    FOLLOW_SKEW_in_adjustment449 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment453 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_adjustment457 = frozenset([1])
    FOLLOW_color_adjustment_in_adjustment466 = frozenset([1])
    FOLLOW_HUE_in_color_adjustment483 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_color_adjustment485 = frozenset([1])
    FOLLOW_SATURATION_in_color_adjustment501 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_color_adjustment503 = frozenset([1])
    FOLLOW_BRIGHTNESS_in_color_adjustment518 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_color_adjustment520 = frozenset([1])
    FOLLOW_ALPHA_in_color_adjustment535 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_color_adjustment537 = frozenset([1])
    FOLLOW_HUE_in_color_adjustment553 = frozenset([32])
    FOLLOW_USER_RATIONAL_TARGET_in_color_adjustment555 = frozenset([1])
    FOLLOW_SATURATION_in_color_adjustment570 = frozenset([32])
    FOLLOW_USER_RATIONAL_TARGET_in_color_adjustment572 = frozenset([1])
    FOLLOW_BRIGHTNESS_in_color_adjustment587 = frozenset([32])
    FOLLOW_USER_RATIONAL_TARGET_in_color_adjustment589 = frozenset([1])
    FOLLOW_ALPHA_in_color_adjustment604 = frozenset([32])
    FOLLOW_USER_RATIONAL_TARGET_in_color_adjustment606 = frozenset([1])
    FOLLOW_TARGETHUE_in_color_adjustment621 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_color_adjustment623 = frozenset([1])
    FOLLOW_TARGETSATURATION_in_color_adjustment639 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_color_adjustment641 = frozenset([1])
    FOLLOW_TARGETBRIGHTNESS_in_color_adjustment656 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_color_adjustment658 = frozenset([1])
    FOLLOW_TARGETALPHA_in_color_adjustment679 = frozenset([20])
    FOLLOW_USER_RATIONAL_in_color_adjustment681 = frozenset([1])



def main(argv, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr):
    from antlr3.main import ParserMain
    main = ParserMain("GencfaLexer", GencfaParser)
    main.stdin = stdin
    main.stdout = stdout
    main.stderr = stderr
    main.execute(argv)


if __name__ == '__main__':
    main(sys.argv)
